"""author: zsw
   data: 2021/10/28
   project: aaaaaaa我爱学习
"""
import re
y = input("请输入密码：")
def cd1(x):
    if len(x)>8:
        return 1
    else:
        return 0 #,"您的密码需要加长"

def cd2(x):
    list1=list(x)
    a=0;b=0;c=0;d=0
    for i in list1:
        num=ord(i)
        if 48<=num<=57:#数字
            a=a+1
        elif 65<=num<=90:#大写字母
            b=b+1
        elif 97<=num<=122:#小写字母
            c=c+1
        elif 33<=num<=126:#符号
            d=d+1
        else:
            pass
    if (a+b+c+d==len(x) and a!=0 and b!=0 and c!=0 and d!=0)| (a+b+c==len(x)and a!=0 and b!=0 and c!=0)| (a+b+d==len(x)and a!=0 and b!=0 and d!=0)|(a+c+d==len(x)and a!=0 and c!=0 and d!=0)|(b+c+d==len(x) and b!=0 and c!=0 and d!=0):
        return 1
    else:
        return 0#,"您的密码需要包含大、小写字母.数字.其它符号中的至少三种"


def cd3(x):
    len2=len(x)
    for i in range(len2):
        if x.count(x[i:i+3])>= 2:
            return 0  # ,"您的密码有长度超过或等于3的子串重复"
        else:
            return 1

t=2+cd1(y)+cd2(y)+cd3(y)
print("您的密码安全等级为：",t)
if t==5:
    print("您的密码很完美")
elif cd1(y)==0 :
    print("您的密码需要加长")
    if cd2(y)==0:
        print("您的密码需要包含大、小写字母.数字.其它符号中的至少三种")
        if cd3(y)==0:
            print("您的密码有长度超过或等于3的子串重复")
        else:
            pass
    else:
        if cd3(y)==0:
            print("您的密码有长度超过或等于3的子串重复")
        else:
            pass
else:
    if cd2(y)==0:
        print("您的密码需要包含大、小写字母.数字.其它符号中的至少三种")
        if cd3(y)==0:
            print("您的密码有长度超过或等于3的子串重复")
        else:
            pass
    else:
        if cd3(y) == 0:
            print("您的密码有长度超过或等于3的子串重复")
        else:
            pass











